import React, { FC }  from 'react'
import {  QuestionRadioPropsType, QuestionRadioDefaultProps } from './interface.ts'
import { Typography, Radio, Space } from 'antd'

const { Paragraph } = Typography
const Component: FC<QuestionRadioPropsType> = (props:QuestionRadioPropsType)=>{
    const { title, options=[], value, isVertical } = {...QuestionRadioDefaultProps,...props}

    return <div>
        <Paragraph strong>{title}</Paragraph>
        <Radio.Group value={value}>
            <Space direction={isVertical ? 'vertical' : 'horizontal'}>
                {options.map((opt,index) =>{
                    const { value,text } = opt
                    return <Radio  key={index} value={value}>{text}</Radio>
                })}
            </Space>
        </Radio.Group>
    </div>
}

export default Component